package Day15;

public class Demo01 {
    public static void main(String[] args) {
        //图书馆里训练任务   登录账号：000000  密码：library
        View v= new View();
        Book b = new Book();
        DoBook d = new DoBook();
        User u = new User();
        boolean login = d.login(v.loginA(),v.loginB());
        if(login == true) {//登录
            while (true) {
                int a = v.xxx();
                switch (a) {
                    case 1: {//图书增加
                        boolean f = d.addBook(v.addBook());
                        if(f == true){
                            System.out.println("添加成功");
                        }else{
                            System.out.println("添加失败");
                        }
                        break;
                    }
                    case 2: {//修改
                        d.reviseBook(v.findBook());
                        break;
                    }
                    case 3:{//删除
                        d.deleteBook(v.deleteBook());
                        break;
                    }
                    case 4:{//查找
                        d.printfBook(d.findBook(v.findBook()));
                        break;
                    }
                    case 5:{//查找
                        int i = v.findAllBook();
                        switch (i){
                            case 1:{//降序
                                d.printAllLower();
                                break;
                            }
                            case 2:{//升序
                                d.printAllRise();
                                break;
                            }
                            case 0:{//退出
                                return;
                            }
                        }
                        break;
                    }
                    case 0:{//退出
                        return;
                    }
                }
            }
        }else{
            System.out.println("登陆失败");
        }
    }
}
